#ifndef __SINGLETON_H__
#define __SINGLETON_H__

#include "noncopyable.h"


//单例
template<typename T>
class Singleton : public noncopyable
{
public:
	static T & get_instance() {
		static T ins;
		do_nothing(instance);
		return ins;
	}
private:
	static T & instance;
	static void do_nothing(T const &) {}

};

template<typename T>
T & Singleton< T >::instance = Singleton< T >::get_instance();

#endif //__SINGLETON_H__